#include <stdio.h>

// a[i] = *(a+i) 
double average(int *a, int n) {
    if (n == 0) {
        return 0;
    }
    double sum = 0;
    for (int i = 0; i < n; i++) {
        sum += a[i];
    }
    return sum / n;
}

int main() {
    int a[] = {1, 5, 9, 10, 3, 5, 7, 9};
    int n = sizeof(a) / sizeof(int);
    double avg = average(a, n);
    printf("avg = %f\n", avg);
    return 0;
}